home *** CD-ROM | disk | FTP | other *** search
Wrap
on memoryInitialise global gSpinLead, gLastSpinTime, gSpinCount, gMemorySize, gSpinWait, gInitialFree, gOutCasts, gOutCastsCount, gOutCastsHold, gSpinOffset, gSpinMem, gDirectory, gDebug, gFreeCutOff, gCastOrderList set gLastSpinTime to ticks() set gMemorySize to memorysize() set gInitialFree to freeBytes() initialiseOutCasts() set gOutCastsCount to count(gOutCasts) set gOutCastsHold to 1 calcLead(memorysize() / 1000000) set gSpinCount to 1 set gSpinWait to 1 if voidp(gSpinOffset) then set gSpinOffset to 0 end if set gFreeCutOff to 1000000 if voidp(gDirectory) then set gDirectory to "Jungle Activated! :" end if setPaths() set gDebug to 0 installf() set gCastOrderList to [] end on calcLead mem global gSpinLead, gSpinMem set gSpinMem to mem * 0.40000000000000002 set gSpinLead to integer(((mem + 0.20000000000000001) * 1.25) - 5) if gSpinLead > 15 then set gSpinLead to 15 end if return gSpinLead end on calcSpinLead mem global gSpinLead, gSpinMem set gSpinMem to mem set gSpinLead to integer(mem / (300000 * 2)) if gSpinLead > 15 then set gSpinLead to 15 end if end on preLoadPics global gSpinLead, gFreeCutOff, gCastOrderList set start to label("Studio") if gSpinLead = 15 then preLoad(start, start + 29) else preLoad(start, start + gSpinLead) preLoad(start + 30 - gSpinLead, start + 29) end if put "Memory after spics = " & the freeBytes repeat with i = 1 to count(gCastOrderList) if freeBytes() > gFreeCutOff then preLoadCast(the number of cast getAt(gCastOrderList, i)) end if end repeat put "Memory after loads = " & the freeBytes end on reLoadPics global gSpinLead, gSpinOffset set middle to frame() - label("Studio") set bottom to middle - gSpinLead set top to middle + gSpinLead set pics to the number of cast "Studio0001" set the preLoadEventAbort to 0 if gSpinLead >= 15 then repeat with i = 0 to 29 if the loaded of cast (pics + i) = 0 then preLoadCast(pics + i) end if end repeat else if (bottom >= 0) and (top <= 29) then repeat with i = 0 to 29 if (i >= bottom) and (i <= top) then if the loaded of cast (pics + i) = 0 then preLoadCast(pics + i) end if next repeat end if unLoadCast(pics + i) end repeat else if bottom < 0 then set bottom to bottom + 30 else set top to top - 30 end if repeat with i = 0 to 29 if (i >= bottom) or (i <= top) then if the loaded of cast (pics + i) = 0 then preLoadCast(pics + i) end if next repeat end if unLoadCast(pics + i) end repeat end if end if set gSpinOffset to 0 set the preLoadEventAbort to 1 end on showSpics global gSpinLead, gSpinOffset set hold to EMPTY set count to 0 repeat with i = 1 to 30 if the loaded of cast (the number of cast "Studio0001" - 1 + i) = 1 then set hold to hold & " " & string(i) set count to count + 1 end if end repeat put hold put "Total = " & string(count) & " Lead = " & string(gSpinLead) & " Offset = " & string(gSpinOffset) & " curr = " & frame() - label("Studio") + 1 end on CalcSpics global gSpinLead, gSpinOffset set hold to EMPTY set count to 0 repeat with i = 1 to 30 if the loaded of cast (the number of cast "Studio0001" - 1 + i) = 1 then set hold to hold & " " & string(i) set count to count + 1 end if end repeat return hold & RETURN & " Total = " & string(count) & " Lead = " & string(gSpinLead) & " Offset = " & string(gSpinOffset) & " curr = " & frame() - label("Studio") + 1 end on fKeyEvent global gMemorySize, gDirectory, gDebug, gFreeCutOff, gInitialFree if gDebug <> -1 then set gDebug to gDebug + 1 if (gDebug = 1) and (the key <> "d") then set gDebug to 0 end if if (gDebug = 2) and (the key <> "e") then set gDebug to 0 end if if (gDebug = 3) and (the key <> "b") then set gDebug to 0 end if if (gDebug = 4) and (the key <> "u") then set gDebug to 0 end if if (gDebug = 5) and (the key <> "g") then set gDebug to 0 end if if (gDebug = 5) and (the key = "g") then set gDebug to -1 set the text of cast "Display" to " Debugging turned on... " doDisplay(120) end if else if the key = "f" then put "ms = " & memorysize() / 1024 & "K fb = " & freeBytes() / 1024 & "K used = " & (memorysize() - freeBytes()) / 1024 & "K" end if if the key = "s" then showSpics() end if if the key = "p" then set gDirectory to the pathName set the text of cast "Display" to " Directory = " & the pathName doDisplay(60) end if if the key = "e" then set gDirectory to "E:\" set the text of cast "Display" to " Directory = E:\ " doDisplay(60) end if if the key = "d" then set gDirectory to "D:\" set the text of cast "Display" to " Directory = D:\ " doDisplay(60) end if if the key = "w" then set gDirectory to EMPTY set the text of cast "Display" to " Directory = <empty> " doDisplay(60) end if if the key = "m" then set the text of cast "Display" to " fb = " & freeBytes() / 1024 & "K used = " & (memorysize() - freeBytes()) / 1024 & "K " doDisplay(60) end if if the key = "n" then set the text of cast "Display" to " Memorysize = " & memorysize() / 1024 & "K" & " Cutoff = " & gFreeCutOff / 1024 & "K" doDisplay(60) end if if the key = "i" then set the text of cast "Display" to " iMemorysize = " & gMemorySize / 1024 & "K" & " ifree = " & gInitialFree / 1024 & "K" doDisplay(60) end if if the key = "b" then set the text of cast "Display" to CalcSpics() doDisplay(120) end if if the key = "1" then changeLead(1000000) end if if the key = "2" then changeLead(2000000) end if if the key = "3" then changeLead(3000000) end if if the key = "4" then changeLead(4000000) end if if the key = "5" then changeLead(5000000) end if if the key = "6" then changeLead(6000000) end if if the key = "7" then changeLead(7000000) end if if the key = "8" then changeLead(8000000) end if if the key = "9" then changeLead(9000000) end if if the key = "0" then changeLead(10000000) end if end if end on doDisplay time puppetSprite(48, 1) set the castNum of sprite 48 to the number of cast "Display" spriteBox(48, 25, 25, 300, 300) set the foreColor of sprite 48 to 230 set the backColor of sprite 48 to 52 set the visible of sprite 48 to 1 updateStage() set atimer to the ticks repeat while (the ticks - atimer) < time end repeat puppetSprite(48, 0) end on changeLead mem global gSpinLead if (frame() >= label("Studio")) and (frame() <= (label("Studio") + 29)) then calcSpinLead(mem) set the text of cast "Display" to " Lead = " & gSpinLead & " loading... " doDisplay(60) reLoadPics() set the text of cast "Display" to " Lead = " & gSpinLead & " loaded!!! " doDisplay(60) end if end on installf set the keyDownScript to "fKeyEvent" end on uninstallf set the keyDownScript to EMPTY end on rightTurnDelete global gSpinLead, gLastSpinTime, gSpinCount, gSpinOffset if gSpinLead < 15 then if gSpinOffset = gSpinLead then set offset to the castNum of sprite 1 - 1 - (2 * gSpinLead) if offset < 0 then set offset to 30 + offset end if unLoadCast(the number of cast "Studio0001" + offset) else set gSpinOffset to gSpinOffset + 1 end if end if set gSpinCount to 1 set gLastSpinTime to the ticks end on leftTurnDelete global gSpinLead, gLastSpinTime, gSpinCount, gSpinOffset if gSpinLead < 15 then if gSpinOffset = -gSpinLead then set offset to the castNum of sprite 1 - 1 + (2 * gSpinLead) if offset > 29 then set offset to offset - 30 end if unLoadCast(the number of cast "Studio0001" + offset) else set gSpinOffset to gSpinOffset - 1 end if end if set gLastSpinTime to the ticks set gSpinCount to 1 end on preLoadStudioPics global gSpinLead, gLastSpinTime, gSpinCount, gSpinWait if gSpinWait > 4 then set gSpinWait to 1 else set gSpinWait to gSpinWait + 1 end if end on ltest index set tlist to [] repeat with i = 1 to 1000 add(tlist, i) end repeat set t0 to the ticks repeat with i = 1 to 5000 set hold to getAt(tlist, index) end repeat put the ticks - t0 end on findCasts start, finish set hold to the frame set thelist to [] repeat with f = start to finish go(f) repeat with S = 1 to 48 set cn to the castNum of sprite S if (cn <> 0) and (getPos(thelist, cn) = 0) then add(thelist, cn) set the purgePriority of cast cn to 1 end if end repeat end repeat go(hold) return thelist end on getCasts xcept set thelist to [] repeat with i = 1 to the number of castMembers if (the castType of cast i <> #empty) and (the castType of cast i <> #script) and (getPos(xcept, i) = 0) then add(thelist, i) end if end repeat return thelist end on prepareList global gOutCasts set gOutCasts to getCasts(findCasts(label("Studio"), label("Studio End"))) put gOutCasts end on initialiseOutCasts global gOutCasts set gOutCasts to [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 45, 49, 50, 51, 52, 53, 55, 56, 63, 80, 196, 202, 203, 204, 205, 206, 207, 211, 216, 217, 223, 225, 227, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 245, 246, 247, 249, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 265, 266, 267, 268, 269, 270, 271, 272, 274, 278, 279, 287, 288, 289, 290, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 325, 328, 329, 330, 331, 332, 334, 335, 336, 337, 341, 342, 343, 344, 345, 346] end on testOutCasts global gOutCasts, gOutCastsCount, gOutCastsHold, gSpinWait, gFreeCutOff if (gSpinWait = 2) or (gSpinWait = 4) then repeat with i = 1 to 20 if the loaded of cast getAt(gOutCasts, gOutCastsHold) = 1 then if freeBytes() < gFreeCutOff then unLoadCast(getAt(gOutCasts, gOutCastsHold)) end if end if if gOutCastsHold = gOutCastsCount then set gOutCastsHold to 1 next repeat end if set gOutCastsHold to gOutCastsHold + 1 end repeat end if end on getpn global gDirectory return gDirectory end on LocalStudioFiles repeat with i = 1 to 30 set the fileName of cast i to getpn() & "wstudio\studio" & string(integer(i / 10)) & string(i mod 10) & ".bmp" end repeat end on showFileNames repeat with i = 1 to the number of castMembers if (the castType of cast i <> #empty) and (the castType of cast i <> #script) and (the fileName of cast i <> EMPTY) then put the fileName of cast i end if end repeat end on replaceFileNames repeat with i = 1 to the number of castMembers if (the castType of cast i <> #empty) and (the castType of cast i <> #script) and (the fileName of cast i <> EMPTY) and (the fileName of cast i contains "Movies") then set hold to the fileName of cast i set hold to the pathName & char offset("Movies", hold) to length(hold) of hold set the fileName of cast the name of cast i to hold end if end repeat end on setPaths global gDirectory if "BBB.MOV" = getNthFileNameInFolder(the pathName & "MOVIES", 1) then replaceFileNames() set gDirectory to the pathName else if "BBB.MOV" = getNthFileNameInFolder("Jungle Activated! :MOVIES", 1) then set gDirectory to "Jungle Activated! :" append(the searchPath, "Jungle Activated! :") else alert("The Jungle Activated CD-ROM has not been found!") quit() end if end if end